<?php

/**
 * @author mahmoud
 */

namespace Kateba\UserBundle\DataFixtures\ORM;

use Doctrine\Common\DataFixtures\FixtureInterface;
use Kateba\RestaurantBundle\Entity\Food;
use Kateba\RestaurantBundle\Entity\Category;
use Kateba\RestaurantBundle\Entity\Extra;
use Kateba\RestaurantBundle\Entity\ExtraPrice;

class LoadRestaurantData implements FixtureInterface {

    public function load(\Doctrine\Common\Persistence\ObjectManager $manager) {
        //create new food Category
        $category = new Category();
        $category->setName('pizza');
        $manager->persist($category);
        
        //create new food for the category
        $food = new Food();
        $food->setName('mashrom pizza');
        $food->setCategory($category);
        $food->setDescription('pizza with mashrom');
        $food->setSmallPrice(9.99);
        $food->setMediumPrice(15.99);
        $manager->persist($food);
        
        //create new food for the category
        $food = new Food();
        $food->setName('checken pizza');
        $food->setCategory($category);
        $food->setDescription('pizza with checken');
        $food->setSmallPrice(9.99);
        $food->setMediumPrice(15.99);
        $manager->persist($food);
        
        //create new food Category
        $category = new Category();
        $category->setName('sandwitch');
        $manager->persist($category);
        
        //create new extra
        $extra = new Extra();
        $extra->setName('mashrom');
        $manager->persist($extra);
        
        //create new price for the extra
        $extraPrice = new ExtraPrice();
        $extraPrice->setCategory($category);
        $extraPrice->setExtra($extra);
        $extraPrice->setPrice(5.9);
        $extraPrice->setSize(1);
        $manager->persist($extraPrice);
        
        //create new food for the category
        $food = new Food();
        $food->setName('sandwitch mashrom');
        $food->setCategory($category);
        $food->setDescription('sandawitch with mashrom');
        $food->setSmallPrice(5.99);
        $food->setMediumPrice(10.99);
        $manager->persist($food);
        
        //save the data
        $manager->flush();
    }

}